package descentFly.app
{
	import UIFree.ObjectEvent;
	import UIFree.uif_component;
	
	import descentFly.app.dialogs.df_alert;
	
	import flash.events.Event;
	
	public class df_baseInterface extends df_modalLayer {
		private var _alert: df_alert;
		public function df_baseInterface(parent:uif_component, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, styleClass:Object='') {
			super(parent, ax, ay, awidth, aheight, styleClass);
		}
		
		override protected function listenEvents():void {
			super.listenEvents();
			addEvent(df_events.ALERT, function(e: ObjectEvent): void {
				showAlert(e.object as String);
			});
		}
		
		protected function showAlert(message: String): df_alert {
			if (message) {
				function doClose(e: Event): void {
					_alert = null;
				}
				if (!_alert) {
					_alert  = new df_alert(this, message);
					_alert.show();
					_alert.addEvent(df_window.CLOSE, doClose);
				}
			}
			return _alert;			
		}
	}
}